var g, _extends = Object.assign || function(t) {
  for (var e = 1; e < arguments.length; e++) {
      var a, r = arguments[e];
      for (a in r) Object.prototype.hasOwnProperty.call(r, a) && (t[a] = r[a]);
  }
  return t;
}, _tools = require("../../utils/tools"), app = getApp(), page = app.page, request = app.util.request, route = app.route, toast = app.toast;
page({
  data: {
      cur: 0,
      swiper_margin: 220 / 750 * wx.getSystemInfoSync().screenWidth,
      score: 0,
      identityDetail: {}
  },
  onLoad: function(t) {
      g = this;
      let userInfo = wx.getStorageSync("userInfo")
      if(userInfo){
        request({
          url: "AddUsersLog",
          data: {
            user_id: userInfo.id,
            url: '/fenxiao/index/index',
            title: "我的身份"
          },
          success: function(a) {
          }
        })
        if(!userInfo.identity_id){
          request({
            url: "Openid",
            showLoading: !1,
            data: {
              user_id: g.data.userInfo.id
            },
            success: function (t) {
              userInfo = t
              request({
                url: "DistributorTypeDetail",
                data: {
                  user_id: userInfo.id,
                  id: userInfo.identity_id,
                },
                success: function(a) {
                  g.setData({
                    identityDetail: a
                  })
                }
              })
            }
          })
        } else {
          request({
            url: "DistributorTypeDetail",
            data: {
              user_id: userInfo.id,
              id: userInfo.identity_id,
            },
            success: function(a) {
              g.setData({
                identityDetail: a
              })
            }
          })
        }
        
      }
      request({
        url: "FxSet",
        data: {
            user_id: wx.getStorageSync("userInfo").id
        },
        showLoading: !1,
        success: function(t) {
            g.setData(_extends({}, t, {
               
            })), app.fxset = t.fxset, wx.setStorageSync("fxset", t.fxset), wx.setStorageSync("wallet", t.wallet), 
            wx.stopPullDownRefresh();
            console.log(g.data.swiper_items)
        }
    });
  },
  onReady: function() {
      var t = wx.getSystemInfoSync().screenWidth, e = .04 * t, t = (e * e + t * t / 4) / (2 * e);
      g.setData({
          style: "background: radial-gradient(circle at 50% " + (e - t) + "px, " + wx.getStorageSync("system").foot_color2 + " " + t + "px, rgba(0,0,0,0) " + t / 2 + "px);"
      }), (0, _tools.getNodeInfo)({
          id: "#top",
          success: function(t) {
              return g.setData({
                  top: t.bottom
              });
          }
      });
  },
  onShow: function() {
      
  },
  onPullDownRefresh: function() {
     
  },
  cardSwiper: function(t) {
      g.setData({
          cur: t.detail.current
      });
  },
  toPage: function(t) {
      var e = t.currentTarget.dataset.url;
      switch (e) {
        case 'upgrade' :
          wx.navigateTo({
            url: "/fenxiao/upgrade/upgrade",
          })
        break;
        default:
          route({
              type: "navigate",
              url: e
          });
      }
  }
});